﻿<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="backstage/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="backstage/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="backstage/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="backstage/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="backstage/static/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="backstage/static/h-ui.admin/css/bootstrap.css" />
<link rel="stylesheet" href="css/Gwodedingdan.css" type="text/css">

<style type="text/css">
.juzhong th{
	text-align: center;
	
}
</style>
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>图片列表</title>

<style type="text/css">
.yinchang{
	border:1px solid #e6e6e6;
	padding:20px;
	background-color:#fff;
	position:fixed;
	top:150px;
	left:400px;
	width:450px;
	height:300px;
	box-shadow: 5px 5px 5px #888888;
}
.bai{
	background-color:#fff;
	position:absolute;
	top:0px;
	left:0px;
	width:100%;
	height:100%;
	opacity:0;
	background-color:#000;
}
</style>

</head>



<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 图片管理 <span class="c-gray en">&gt;</span> 图片列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="${dizhi }" id="form1">
		<div class="text-c"> 日期范围：
			<input type="text" value="${s1 }" name="s1" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}' })" id="logmin" class="input-text Wdate" style="width:120px;">
			-
			<input type="text" value="${s2 }" name="s2" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'logmin\')}',maxDate:'%y-%M-%d' })" id="logmax" class="input-text Wdate" style="width:120px;">
			<input type="text" value="${orderid }" name="orderid" id="" placeholder=" 订单号" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
			<input type="hidden" name="no" id="no" value="${no }"/>
		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a class="btn btn-primary radius" onclick="picture_add('添加图片','picture-add.html')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加图片</a></span> <span class="r">共有数据：<strong>54</strong> 条</span> </div>
	<div class="mt-20">
		<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer"><div class="dataTables_length" id="DataTables_Table_0_length">
			
		</div>
		<div id="DataTables_Table_0_filter" class="dataTables_filter">
			
		</div>
			<c:forEach items="${list }" var="a">
	            <table border="0.5px" cellspacing="0px" cellspacing="0" style="width:100%" class="juzhong">
	            	<thead>
	            		<tr>
	            			<th style="width:15px">用户名:${a.user.name }</th>
	            			<th>&nbsp;&nbsp; ${a.orderdate }</th>
	            			<th style="width:200px">&emsp;&emsp;订单号：${a.orderii }</th>
	            			<th>单价</th>
	            			<th>数量</th>
	            			<th>商品小计</th>
	            			<th>应付金额</th>
	            			<th>查看详情></th>
	            		</tr>
	            	</thead>
	            	<tbody>
	            	<input type="hidden" id="hidden"/>
		            		<c:forEach items="${a.orderid }" var="b" varStatus="row">
		            		 	<c:if test="${row.count==1}"> 
			            		 	<tr>
			            		 		<td>${b.gouwuche.id }</td>
				            			<td><img src="${b.gouwuche.tu }" width="90px" height="90px"></td>
				            			<td>${b.gouwuche.ming }</td>
				            			<td>￥<span style="color:red">${b.gouwuche.money }</span></td>
				            			<td>${b.gouwuche.sum }</td>
				            			<td>${b.gouwuche.zhongjia }</td>
				            			<td class="xiayige" rowspan="${a.orderid.size() }" style="vertical-align:top;">￥<span style="color:red">${a.total }</span></td>
				            			<c:choose>
				            				<c:when test="${a.zhuangid==1 }">
				            					<td rowspan="${a.orderid.size() }" style="vertical-align:top;"><span>未付款</span>&emsp;&emsp;<input type="hidden" value="${a.zhuangid }"><input type="hidden" value="${a.orderii }"><a class="xiugai">修改</a></td>
				            				</c:when>
				            				<c:when test="${a.zhuangid==2 }">
				            					<td rowspan="${a.orderid.size() }" style="vertical-align:top;"><span>准备发货</span>&emsp;&emsp;<input type="hidden" value="${a.zhuangid }"><input type="hidden" value="${a.orderii }"><a class="xiugai">修改</a></td>
				            				</c:when>
				            				<c:when test="${a.zhuangid==3 }">
				            					<td rowspan="${a.orderid.size() }" style="vertical-align:top;"><span>已发货</span>&emsp;&emsp;<input type="hidden" value="${a.zhuangid }"><input type="hidden" value="${a.orderii }"><a class="xiugai">修改</a></td>
				            				</c:when>
				            				<c:when test="${a.zhuangid==4 }">
				            					<td rowspan="${a.orderid.size() }" style="vertical-align:top;"><span>已签收</span>&emsp;&emsp;<input type="hidden" value="${a.zhuangid }"><input type="hidden" value="${a.orderii }"><a class="xiugai">修改</a></td>
				            				</c:when>
				            			</c:choose>
				            			
			            			</tr>
		            			</c:if>
		            			<c:if test="${row.count!=1}"> 
			            			<tr>
			            				<td>${b.gouwuche.id }</td>
				            			<td><img src="${b.gouwuche.tu }" width="90px" height="90px"></td>
				            			<td>${b.gouwuche.ming }</td>
				            			<td>￥<span style="color:red">${b.gouwuche.money }</span></td>
				            			<td>${b.gouwuche.sum }</td>
				            			<td>${b.gouwuche.zhongjia }</td>
				            		</tr>
		            			</c:if>
		            			
		            		</c:forEach>
	            	</tbody>
	            </table>
	            <br>
	            <hr>
	            <br>
            </c:forEach>
		<!-- 分页栏开始 -->
	    <div style="text-align:center;">
		    <nav aria-label="Page navigation">
			  <ul class="pagination">
			  	<li><a href="#" onclick="go(1);return false">首页</a></li>
			    <li><a href="#" onclick="go(${page.prevPage});return false">上一页</a></li>
			    <c:forEach begin="1" end="${page.totalPage }" var="i">
			    <c:if test="${page.pageNo==i }" var="active">
			    <li class="active"><a href="#" onclick="go(${i});return false">${i }</a></li>
			    </c:if>
			    <c:if test="${not active }">
			    <li><a href="#" onclick="go(${i });return false">${i }</a></li>
			    </c:if>
			    </c:forEach>
			    <li><a href="#" onclick="go(${page.nextPage});return false">下一页</a></li> 
			    <li><a href="#" onclick="go(${page.totalPage});return false">末页</a></li>
			    <li><a href="#">总页数：${page.totalPage }页</a></li>
			    <li><a href="#">总条数：${page.totalCount }页</a></li>
			  </ul>
			</nav>
	  	</div>
	  	<!-- 分页栏结束 -->
	</div>
		</div>
	</div>

<div class="bai" style="display:none"></div>
<div class="yinchang" style="display:none">
	<form action="hzhuangtaixiugai.do" method="post" class="form form-horizontal" id="form-change-password">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select name="zhuangtai" id="zhuangtai">
					<option value="请选择">请选择 </option>
					<option value="1">已付款</option>
					<option value="2">准备发货</option>
					<option value="3">已发货</option>
					<option value="4">已签收</option>
				</select>
			</div>
			<input type="hidden" id="orderid" name="orderid" />
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" id="button" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>



<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="backstage/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="backstage/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="backstage/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="backstage/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="backstage/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="backstage/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="backstage/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
	function go(no){
			
			//将要跳转的页码存入表单隐藏域中
			$('#no').val(no);
			//提交表单
			$('#form1').trigger('submit');
		}


$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8]}// 制定列不参与排序
	]
});

/*图片-添加*/
function picture_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

/*图片-查看*/
function picture_show(title,url,id){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

/*图片-审核*/
function picture_shenhe(obj,id){
	layer.confirm('审核文章？', {
		btn: ['通过','不通过'], 
		shade: false
	},
	function(){
		$(obj).parents("tr").find(".td-manage").prepend('<a class="c-primary" onClick="picture_start(this,id)" href="javascript:;" title="申请上线">申请上线</a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发布</span>');
		$(obj).remove();
		layer.msg('已发布', {icon:6,time:1000});
	},
	function(){
		$(obj).parents("tr").find(".td-manage").prepend('<a class="c-primary" onClick="picture_shenqing(this,id)" href="javascript:;" title="申请上线">申请上线</a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">未通过</span>');
		$(obj).remove();
    	layer.msg('未通过', {icon:5,time:1000});
	});	
}
$(function(){
	$(".xiayige").next().children("a").click(function(){
		var hao = $(this).prev().val();
		var zhuang = $(this).prev().prev().val();
		$("#zhuangtai").val(zhuang);
		$("#orderid").val(hao);
		$(".yinchang").slideDown(500);
		$(".bai").show();
	})
	
	$("#form-change-password").submit(function(){
		$(".yinchang").slideUp(500);
		$(".bai").hide();
		var id = $("#zhuangtai").val();
		$("#hidden").val(id);
	})
	
	$(".bai").click(function(){
			$(".yinchang").slideUp(500);
			$(".bai").hide();
		})
	
})
function xiu(obj,id){
	$("#zhuangtai").val(id);
	$(".yinchang").slideDown(500);
	$(".bai").show();
}


/*图片-下架*/
function picture_stop(obj,id){
	layer.confirm('确认要下架吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="picture_start(this,id)" href="javascript:;" title="发布"><i class="Hui-iconfont">&#xe603;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已下架</span>');
		$(obj).remove();
		layer.msg('已下架!',{icon: 5,time:1000});
	});
}

/*图片-发布*/
function picture_start(obj,id){
	layer.confirm('确认要发布吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="picture_stop(this,id)" href="javascript:;" title="下架"><i class="Hui-iconfont">&#xe6de;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发布</span>');
		$(obj).remove();
		layer.msg('已发布!',{icon: 6,time:1000});
	});
}

/*图片-申请上线*/
function picture_shenqing(obj,id){
	$(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">待审核</span>');
	$(obj).parents("tr").find(".td-manage").html("");
	layer.msg('已提交申请，耐心等待审核!', {icon: 1,time:2000});
}

/*图片-编辑*/
function picture_edit(title,url,id){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

/*图片-删除*/
function picture_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '',
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}
</script>
</body>
</html>